@@ -164,7 +164,7 @@ $(document).ready -> |
||
164 | 164 |
|
165 | 165 |
$(".description").html(json.description_html) if json.description_html? |
166 | 166 |
|
167 |
- $('.oauthable-form').html($(json.form).find('.oauthable-form').html()) if json.form? |
|
167 |
+ $('.oauthable-form').html(json.form) if json.form? |
|
168 | 168 |
|
169 | 169 |
if $("#agent_options").hasClass("showing-default") || $("#agent_options").val().match(/\A\s*(\{\s*\}|)\s*\Z/g) |
170 | 170 |
window.jsonEditor.json = json.options |
@@ -31,14 +31,15 @@ class AgentsController < ApplicationController |
||
31 | 31 |
end |
32 | 32 |
|
33 | 33 |
def type_details |
34 |
- agent = Agent.build_for_type(params[:type], current_user, {}) |
|
34 |
+ @agent = Agent.build_for_type(params[:type], current_user, {}) |
|
35 | 35 |
render :json => { |
36 |
- :can_be_scheduled => agent.can_be_scheduled?, |
|
37 |
- :default_schedule => agent.default_schedule, |
|
38 |
- :can_receive_events => agent.can_receive_events?, |
|
39 |
- :can_create_events => agent.can_create_events?, |
|
40 |
- :options => agent.default_options, |
|
41 |
- :description_html => agent.html_description |
|
36 |
+ :can_be_scheduled => @agent.can_be_scheduled?, |
|
37 |
+ :default_schedule => @agent.default_schedule, |
|
38 |
+ :can_receive_events => @agent.can_receive_events?, |
|
39 |
+ :can_create_events => @agent.can_create_events?, |
|
40 |
+ :options => @agent.default_options, |
|
41 |
+ :description_html => @agent.html_description, |
|
42 |
+ :form => render_to_string(partial: 'oauth_dropdown') |
|
42 | 43 |
} |
43 | 44 |
end |
44 | 45 |
|
@@ -31,12 +31,7 @@ |
||
31 | 31 |
</div> |
32 | 32 |
|
33 | 33 |
<div class='oauthable-form'> |
34 |
- <% if @agent.try(:oauthable?) %> |
|
35 |
- <div class="form-group type-select"> |
|
36 |
- <%= f.label :service %> |
|
37 |
- <%= f.select :service_id, options_for_select(@agent.valid_services(current_user).collect { |s| ["(#{s.provider}) #{s.name}", s.id]}, @agent.service_id),{}, class: 'form-control' %> |
|
38 |
- </div> |
|
39 |
- <% end %> |
|
34 |
+ <%= render partial: 'oauth_dropdown' %> |
|
40 | 35 |
</div> |
41 | 36 |
|
42 | 37 |
<div class="form-group"> |
@@ -0,0 +1,6 @@ |
||
1 |
+<% if @agent.try(:oauthable?) %> |
|
2 |
+ <div class="form-group type-select"> |
|
3 |
+ <%= label_tag :service %> |
|
4 |
+ <%= select_tag 'agent[service_id]', options_for_select(@agent.valid_services(current_user).collect { |s| ["(#{s.provider}) #{s.name}", s.id]}, @agent.service_id), class: 'form-control' %> |
|
5 |
+ </div> |
|
6 |
+<% end %> |